package com.example.service;

import com.example.entity.Role;
import com.example.mapper.RoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RoleService {

    @Autowired
    private RoleMapper roleMapper;

    /**
     * 任务二：根据角色ID查询角色及其菜单权限
     */
    public Role getRoleWithMenusById(Long roleId) {
        return roleMapper.selectRoleWithMenusById(roleId);
    }

    /**
     * 任务二：根据角色名称查询角色及其菜单权限
     */
    public Role getRoleWithMenusByName(String roleName) {
        return roleMapper.selectRoleWithMenusByName(roleName);
    }
}
